macos: resign main/key when hiding window
authorChristian Hergert <chergert@redhat.com>
Wed, 2 Dec 2020 19:35:22 +0000 (11:35 -0800)
committerChristian Hergert <chergert@redhat.com>
Wed, 2 Dec 2020 19:36:38 +0000 (11:36 -0800)
This isn't done automatically for us, so we need to synthesize it in
our hide helper.

With this commit, we properly re-focus the new main/key window after
we have closed a transient-for window.

gdk/macos/GdkMacosWindow.c

index 92cfa622eb8e140026ff639e8167c72060c286af..46a97adcfc64759b4a901cfa6d17cd1b5f94f9c6 100644 (file)
 
 -(void)hide
 {
+  BOOL wasKey = [self isKeyWindow];
+  BOOL wasMain = [self isMainWindow];
+
   inShowOrHide = YES;
   [self orderOut:nil];
   inShowOrHide = NO;
 
   initialPositionKnown = NO;
+
+  if (wasMain)
+    [self windowDidResignMain:nil];
+
+  if (wasKey)
+    [self windowDidResignKey:nil];
 }
 
 -(BOOL)trackManualMove